import os
from datetime import timedelta

class Config:
    # 基础配置
    SECRET_KEY = 'zhangchi_js22150332_another_secret_key_67890!'
    SITE_TITLE = "张驰的个人空间"
    
    # 数据库配置
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://js22150332:js22150332@81.69.190.161/js22150332'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    
    # 邮件配置
    MAIL_SERVER = 'smtp.163.com'
    MAIL_PORT = 465
    MAIL_USE_SSL = True
    MAIL_USERNAME = '15116672656@163.com'
    MAIL_PASSWORD = 'TVnz8jWDrtvk2m3P'  # 邮箱授权码
    MAIL_DEFAULT_SENDER = ('张驰的个人空间', '15116672656@163.com')
    
    # 验证码邮件配置
    VERIFICATION_MAIL_SUBJECT_ZC = "邮箱验证 - 张驰的个人空间"
    
    # 会话配置
    PERMANENT_SESSION_LIFETIME = timedelta(days=7)
    
    # 文件上传配置
    UPLOAD_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'static/uploads')
    MAX_CONTENT_LENGTH = 16 * 1024 * 1024  # 16MB max file size
    
    # 验证码配置
    CAPTCHA_EXPIRATION = 600  # 验证码有效期（秒） 